//****************************************************************
// Autor:   Yimy Juarez 
//          Gustavo Castro
//          Ulil Coqti
//          Josué Barrientos
//       
// Seccion: 10
// Nombre del Archivo: DoublyLinkedList.java
// Fecha de Modificacion:08/08/2012
// Descripcion:
// Clase de implementación de la lista doblemente encadenada
// ***************************************************************
package hojadetrabajo4;

import java.util.Iterator;


public class DoublyLinkedList<E> extends abstractList<E> {
    
protected int count;
protected DoublyLinkedNode<E> head;
protected DoublyLinkedNode<E> tail;

public DoublyLinkedList()
// post: constructs an empty list
{
   head = null;
   tail = null;
   count = 0;
}


public void addFirst(E value)
// pre: value is not null
// post: adds element to head of list
{
   // construct a new element, making it head
   head = new DoublyLinkedNode<E>(value, head, null);
   // fix tail, if necessary
   if (tail == null) tail = head;
   count++;
}


public void addLast(E value)
// pre: value is not null
// post: adds new value to tail of list
{
   // construct new element
   tail = new DoublyLinkedNode<E>(value, null, tail);
   // fix up head
   if (head == null) head = tail;
   count++;
}


public E removeLast()
// pre: list is not empty
// post: removes value from tail of list
{
   DoublyLinkedNode<E> temp = tail;
   tail = tail.previous();
   if (tail == null) {
       head = null;
   } else {
       tail.setNext(null);
   }
   count--;
   return temp.value();
}
    
   public E getFirst()
   // pre: list is not empty
   // post: returns first value in list
   {
       return null;
   }        
   
   public E getLast()
   // pre: list is not empty
   // post: returns last value in list
   {
       return null;
   }
           
   public E removeFirst()
   // pre: list is not empty
   // post: removes first value from list
   {
       return null;
   }
           

   public E remove(E value)
   // post: removes and returns element equal to value
   // otherwise returns null
   {
       return null;
   }

   public void add(E value)
   // post: value is added to tail of list
   {
       
   }

   public E remove()
   // pre: list has at least one element
   // post: removes last value found in list
   {
       return null;
   }

   public E get()
   // pre: list has at least one element
   // post: returns last value found in list
   {
       return null;
   }
 

   public int indexOf(E value)
   // pre: value is not null
   // post: returns (0-origin) index of value,
   // or -1 if value is not found
   {
       return 0;
   }

   public int lastIndexOf(E value)
   // pre: value is not null
   // post: returns (0-origin) index of value,
   // or -1 if value is not found
   {
       return 0;
   }

   public E get(int i)
   // pre: 0 <= i < size()
   // post: returns object found at that location
   {
       return null;
   }

   public E set(int i, E o)
   // pre: 0 <= i < size()
   // post: sets ith entry of list to value o;
   // returns old value
   {
       return null;
   }
           
   public void add(int i, E o)
   // pre: 0 <= i <= size()
   // post: adds ith entry of list to value o
   {
   }

   public E remove(int i)
   // pre: 0 <= i < size()
   // post: removes and returns object found at that location
   {
       return null;
   }

   public Iterator<E> iterator()
   // post: returns an iterator allowing
   // ordered traversal of elements in list
   {
       return null;
   }

    public int size() {
        return count;
    }

    
    public void clear() {
       
    }
}

